define(["jquery", "easy-admin"], function ($, ea) {

    var init = {
        table_elem: '#currentTable',
        table_render_id: 'currentTableRenderId',
        index_url: 'task.tlist/index',
        add_url: 'task.tlist/add',
        edit_url: 'task.tlist/edit',
        delete_url: 'task.tlist/delete',
        export_url: 'task.tlist/export',
        modify_url: 'task.tlist/modify',
    };

    var Controller = {

        index: function () {
            ea.table.render({
                init: init,
                toolbar: ['refresh','delete','export'],
                cols: [[
                    {type: 'checkbox'},
                    {field: 'id', title: 'id',search:false},
                    {field: 'taskCustomer.name', title: '客户姓名',search:false},
                    // {field: 'order_id', title: '订单ID'},
                    // {field: 'node_id', title: '节点ID'},
                    // {field: 'node_type', title: '节点类型 0普通节点 1客户节点 2订单节点'},
                    {field: 'node_name', title: '节点名称',search:false},
                    // {field: 'process_id', title: '步骤ID'},
                    {field: 'process_name', title: '步骤名称',search:false},
                    // {field: 'process_status', title: '节点状态值'},
                    // {field: 'process_content', title: '步骤内容'},
                    {field: 'receiveAdmin.nickname', title: '接受人'},
                    {field: 'receive_time', title: '接受时间', search: 'range'},
                    {field: 'is_receive', title: '是否接收',selectList: {0: '否', 1: '是'}},
                    // {field: 'is_audit', title: '是否审核'},
                    {field: 'audit_status', title: '审核状态',selectList: {'-1': '退回重做', 0: '待审核',1:'已审核'}}, //-1 退回重做 0 待审核 1 已审核
                    // {field: 'audit_idea', title: '审核意见'},
                    {field: 'auditAdmin.nickname', title: '审核人',search:false},
                    // {field: 'audit_time', title: '审核时间'},
                    {field: 'createAdmin.nickname', title: '任务发起人',search:false},
                    // {field: 'is_submit', title: '是否提交'},
                    // {field: 'submit_time', title: '提交时间'},

                    // {field: 'audit_admin_ids', title: '审核人ids'},
                    {field: 'deadline_time', title: '截止日期', search: 'range'},
                    // {field: 'task_file', title: '任务附件'},
                    // {field: 'copyAdmin.nickname', title: '抄送人'},
                    // {field: 'task_imgs', title: '任务图片'},
                    // {field: 'action_table_id', title: 'action_table_id'},
                    {field: 'create_time', title: '创建时间', search: 'range'},

                    {width: 250, title: '操作', templet: ea.table.tool,operat: [
                            [{
                                text: '详情',
                                url: init.edit_url,
                                method: 'open',
                                auth: 'edit',
                                class: 'layui-btn layui-btn-success layui-btn-xs',
                            }],
                        ]},
                ]],
            });

            ea.listen();
        },
        add: function () {
            ea.listen();
        },
        edit: function () {
            ea.listen();
        },
    };
    return Controller;
});